package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class Plan extends AppCompatActivity {

    private EditText editText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_plan);

        editText=(EditText)findViewById(R.id.edit);
        editText.setEnabled(false);

        Button button=(Button)findViewById(R.id.button_edit);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {



                if (button.getText().equals("编辑"))
                {
                    Toast.makeText(Plan.this,"可以编辑",Toast.LENGTH_SHORT).show();
                    editText.setEnabled(true);
                    button.setText("保存");
                }
                else
                {
                    Toast.makeText(Plan.this,"不可编辑",Toast.LENGTH_SHORT).show();
                    editText.setEnabled(false);
                    button.setText("编辑");
                }

            }
        });

    }


}